#ifndef WIDGET_H
#define WIDGET_H

#include "spot.h"
#include "../external/RVO2/src/RVO.h"
#include <QWidget>
#include <QVector>
#include <QPainter>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

private:
    struct Node {
        int r;
        int id;
        RVO::Vector2 pos;
    };

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    void initSrcSpot();
    void initDstSpot();
    void initTimer_createrSpots();
    void initTimer_updateSimulator();
    void initSimulator();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

private:
    void changeEvent(QEvent *event) override;
    void paintEvent(QPaintEvent *) override;

    void updateSimulator();
private:
    QVector<Node*> _nodes;
    Spot* _src;
    Spot* _dst;

    RVO::RVOSimulator* _simulator;
    QTimer* _timer_updateSimulator;
    QTimer* _timer_createrSpots;
private:
    Ui::Widget *ui;
};
#endif // WIDGET_H
